package com.app.shop.adapters;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.Nullable;


import com.app.shop.R;
import com.app.shop.beans.ShopCarBean;
import com.app.library.utils.GlideUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;



public class  ShopCarAdapter extends BaseQuickAdapter<ShopCarBean, ShopCarAdapter.ViewHolder> {


    public ShopCarAdapter(int layout, @Nullable List<ShopCarBean> data) {
        super(layout, data);
    }

    @Override
    protected void convert(ViewHolder holder, ShopCarBean bean) {

        GlideUtils.getInstance().loadImage(mContext, bean.getGood_pic_path(), holder.imgv_pic);
        holder.tv_name.setText(bean.getGoods_name());
        holder.tv_remark.setText(bean.getStore_name());
        holder.tv_price.setText("￥" + bean.getGoods_price());
        holder.tv_del.setVisibility(View.VISIBLE);
        holder.addOnClickListener(R.id.tv_del_item);
    }


    public class ViewHolder extends BaseViewHolder {
        ImageView imgv_pic;
        TextView tv_name;
        TextView tv_remark;
        TextView tv_price;
        TextView tv_del;


        public ViewHolder(View view) {
            super(view);
            imgv_pic = view.findViewById(R.id.imgv_list);
            tv_name = view.findViewById(R.id.tv_list_item);
            tv_remark = view.findViewById(R.id.tv_list_type);
            tv_price = view.findViewById(R.id.tv_price);
            tv_del = view.findViewById(R.id.tv_del_item);
        }
    }
}
